<div class="user">
    <nz-collapseset>
        <nz-collapse [nzTitle]="panels.name" [nzActive]="panels.active" [nzDisabled]="panels.disabled">
            <form nz-form [nzLayout]="'inline'">
                <div nz-row>
                    <!-- <div nz-form-item nz-col [nzSpan]="12"> -->
                    <div nz-form-label nz-col [nzSpan]="2">
                        <label>被检查机构</label>
                    </div>
                    <div nz-form-control nz-col [nzSpan]="6">
                        <nz-select style="width: 260px;" name="qUsedPartyId" nzAllowClear [nzPlaceHolder]="'请选择'"
                            [(ngModel)]="qUsedPartyId" nzShowSearch>
                            <nz-option *ngFor="let option of partyOtion" [nzLabel]="option.partyName" [nzValue]="option.id"
                                [nzDisabled]="option.disabled">
                            </nz-option>
                        </nz-select>
                    </div>
                    <!-- </div> -->
                    <!-- <div nz-form-item nz-col [nzSpan]="12"> -->
                    <div nz-form-label nz-col [nzSpan]="2">
                        <label>计划类型</label>
                    </div>
                    <div nz-form-control nz-col [nzSpan]="3">
                        <nz-select style="width: 150px;" nzAllowClear [nzPlaceHolder]="'请选择'" [(ngModel)]="checkType"
                            [nzShowSearch]="true" name="checkType">
                            <nz-option *ngFor="let option of planTypeList" [nzLabel]="option.label" [nzValue]="option.value"></nz-option>
                        </nz-select>
                    </div>
                    <!-- </div> -->
                </div>
                <div nz-row>
                    <!-- <div nz-form-item nz-col [nzSpan]="12"> -->
                    <div nz-form-label nz-col [nzSpan]="2">
                        <label>执法文书</label>
                    </div>
                    <div nz-form-control nz-col [nzSpan]="6">
                        <nz-select style="width: 150px;" name="hasLawDocs" nzAllowClear [nzPlaceHolder]="'请选择(有无)'"
                            [(ngModel)]="hasLawDocs" nzShowSearch>
                            <nz-option [nzLabel]="'有'" [nzValue]="1"></nz-option>
                            <nz-option [nzLabel]="'无'" [nzValue]="0"></nz-option>
                        </nz-select>
                    </div>
                    <!-- </div> -->
                    <!-- <div nz-form-item nz-col [nzSpan]="12"> -->
                    <div nz-form-label nz-col [nzSpan]="2">
                        <label>行政处罚</label>
                    </div>
                    <div nz-form-control nz-col [nzSpan]="4">
                        <nz-select style="width: 150px;" nzAllowClear [nzPlaceHolder]="'请选择(有无)'" [(ngModel)]="hasPunishmentDocs"
                            [nzShowSearch]="true" name="hasPunishmentDocs">
                            <nz-option [nzLabel]="'有'" [nzValue]="1"></nz-option>
                            <nz-option [nzLabel]="'无'" [nzValue]="0"></nz-option>
                        </nz-select>
                    </div>
                    <!-- </div> -->
                </div>

                <div nz-row>
                    <div style="width:47.5%" nz-form-item nz-col [nzSpan]="14" [nzOffset]="2">
                        <nz-datepicker style="width: 48%;" name="1" (ngModelChange)="_startDate=$event;_startValueChange()"
                            [ngModel]="_startDate" [nzDisabledDate]="_disabledStartDate" [nzShowTime]="true" [nzFormat]="'YYYY-MM-DD HH:mm:ss'"
                            [nzPlaceHolder]="'开始时间'"></nz-datepicker>
                        <nz-datepicker style="width: 48%;" name="2" (ngModelChange)="_endDate=$event;_endValueChange()"
                            [ngModel]="_endDate" [nzDisabledDate]="_disabledEndDate" [nzShowTime]="_endTime" [nzFormat]="'YYYY-MM-DD HH:mm:ss'"
                            [nzPlaceHolder]="'结束时间'"></nz-datepicker>
                    </div>
                    <button nz-button [nzSize]="'large'" [nzType]="'primary'" (click)="query()">查询</button>
                </div>

            </form>
        </nz-collapse>
    </nz-collapseset>

    <nz-table #nzTable [nzDataSource]="list" nzSize="middle" [nzBordered]="true" [nzIsPagination]="false"
        (nzDataChange)="displayDataChange($event)">
        <thead nz-thead>
            <tr>
                <th nz-th [nzCheckbox]="true">
                    <label nz-checkbox [(ngModel)]="allChecked" [nzIndeterminate]="indeterminate" (ngModelChange)="checkAll($event)">
                    </label>
                </th>
                <th nz-th><span>检查日期</span></th>
                <th nz-th><span>检查机构</span></th>
                <th nz-th><span>被检查机构</span></th>
                <th nz-th><span>检查类别</span></th>
                <th nz-th><span>检查人</span></th>
                <th nz-th><span>记录人</span></th>
                <th nz-th><span>是否已确认</span></th>
                <th nz-th><span>计划完成状态</span></th>
                <th nz-th><span>执法文书</span></th>
                <th nz-th><span>行政处罚书</span></th>
                <th nz-th><span>检查存证</span></th>
                <th nz-th><span>导出</span></th>
            </tr>
        </thead>
        <tbody nz-tbody>
            <tr nz-tbody-tr *ngFor="let data of list">
                <td nz-td [nzCheckbox]="true">
                    <label nz-checkbox [nzDisabled]="data.disabled" [(ngModel)]="data.checked" (ngModelChange)="refreshStatus($event)">
                    </label>
                </td>
                <td nz-td>{{data.checkTimeTo | timeTrans}}</td>
                <td nz-td>{{data.rsponPartyName}}</td>
                <td nz-td>{{data.partyName}}</td>
                <td nz-td>{{data.checkItem | constantTransfer:checkItems}}</td>
                <td nz-td>{{data.checkerName}}</td>
                <td nz-td>{{data.recorderName}}</td>
                <td nz-td>{{data.isSure==1?'是':'否'}}</td>
                <td nz-td>{{data.state==1?'已完成':'待整改'}}</td>
                <td nz-td><span>
                        <p>{{data.lawDocNos}}</p>
                        <button nz-button [nzSize]="'small'" [nzType]="'primary'" (click)="uploadwenj(data,1)">上传</button>
                    </span></td>
                <td nz-td><span>
                        <p>{{data.punishmentDocNos}}</p>
                        <button nz-button [nzSize]="'small'" [nzType]="'primary'" (click)="uploadwenj(data,2)">上传</button>
                    </span></td>
                <td nz-td><span>
                        <button nz-button [nzSize]="'small'" [nzType]="'primary'" (click)="uploadwenj(data,3)">上传</button>
                    </span></td>
                <td nz-td><span>
                        <nz-popover [nzTitle]="'请选择'" [nzPlacement]="'bottom'" [nzTrigger]="'click'">
                            <button nz-button [nzSize]="'small'" [nzType]="'primary'" nz-popover>导出</button>
                            <ng-template #nzTemplate>
                                <div>
                                    <button nz-button [nzSize]="'small'" (click)="downloadwenj(data,1)">现场监督检查记录</button>
                                </div>
                                <div style="margin-top:10px">
                                    <button nz-button [nzSize]="'small'" (click)="downloadwenj(data,2)">执法文书</button>
                                </div>
                                <div style="margin-top:10px">
                                    <button nz-button [nzSize]="'small'" (click)="downloadwenj(data,3)">行政处罚书</button>
                                </div>
                                <div style="margin-top:10px">
                                    <button nz-button [nzSize]="'small'" (click)="downloadwenj(data,4)">检查存证记录</button>
                                </div>
                                <div style="margin-top:10px">
                                    <button nz-button [nzSize]="'small'" (click)="downloadwenj(data,5)">委托检测报告</button>
                                </div>
                            </ng-template>
                        </nz-popover>
                    </span></td>
            </tr>
        </tbody>
    </nz-table>
    <nz-pagination [nzPageIndex]="safeControlBean.currentPage" nzShowTotal [nzTotal]="total" nzShowSizeChanger
        (nzPageSizeChange)="nzPageSizeChange($event)" (nzPageIndexChange)="nzPageIndexChange($event)"
        (nzPageIndexClickChange)="nzPageIndexClickChange($event)" [nzPageSize]="safeControlBean.pageSize"></nz-pagination>


    <!--添加执法文书 -->
    <!--添加行政处罚书 -->
    <!--添加检查存证 -->
    <nz-modal [nzVisible]="isVisible" [nzTitle]="'文件上传'" [nzOkText]="'确定'" [nzCancelText]="'取消'" [nzContent]="modalContent"
        (nzOnCancel)="isVisible=false" (nzOnOk)="isVisible=false">
        <ng-template #modalContent>
            <nz-spin [nzTip]="'正在上传请等待...'" [nzSpinning]="nzSpinning1">
                <nz-input *ngIf="uploadType==1" style="padding-bottom: 30px" [(ngModel)]="lawDocNos" nzType="textarea"
                    [nzAutosize]="autosize" nzPlaceHolder="请输入执法文书编号，多个以英文逗号分隔"></nz-input>

                <nz-input *ngIf="uploadType==2" style="padding-bottom: 30px" [(ngModel)]="punishmentDocNos" nzType="textarea"
                    [nzAutosize]="autosize" nzPlaceHolder="请输入行政处罚书编号，多个以英文逗号分隔"></nz-input>


                <nz-upload *ngIf="uploadType==1" nzAction="{{config.IP+config.API.uploadbig}}" [nzBeforeUpload]="beforeUpload"
                    [(nzFileList)]="lawfileList"
                    (nzChange)="uploadChage($event)">
                    <button nz-button>
                      <i class="anticon anticon-upload"></i>
                      <span>上传执法文书</span>
                    </button>
                </nz-upload>

                <nz-upload *ngIf="uploadType==2" nzAction="{{config.IP+config.API.upload}}" nzListType="picture-card"
                    [(nzFileList)]="punfileList" [nzShowButton]="true" [nzRemove]="nzRemoveFilelaw" [nzPreview]="handlePreviewlaw"
                    (nzChange)="nzChangelaw($event)">
                    <i class="anticon anticon-plus"></i>
                    <div class="ant-upload-text">上传</div>
                </nz-upload>


                <nz-upload *ngIf="uploadType==3" nzAction="{{config.IP+config.API.uploadbig}}" [nzBeforeUpload]="beforeUpload"
                    (nzChange)="uploadChage($event)" [nzFileList]="enefileList" [nzRemove]="nzRemoveFilelaw">
                    <button nz-button>
                        <i class="anticon anticon-upload"></i>
                        <span>上传检查存证</span>
                    </button>
                </nz-upload>
                <p *ngIf="uploadType==3" style="margin-top:20px;color:red;font-weight:700;">最大文件大小为500M！</p>


                <div style="text-align: center;margin-top: 30px;">
                    <button nz-button [nzSize]="'large'" (click)="update()" [nzType]="'primary'">确定上传</button>
                </div>

            </nz-spin>

        </ng-template>
    </nz-modal>


    <nz-modal [nzVisible]="previewVisiblelaw" [nzContent]="modalContent11" [nzFooter]="null" (nzOnCancel)="previewVisiblelaw=false">
        <ng-template #modalContent11>
            <img [src]="previewImagelaw" [ngStyle]="{ 'width': '100%' }" />
        </ng-template>
    </nz-modal>

</div>
